﻿@{
	ViewBag.Title = T("Manage forums");
}
	<ul class="path floatContainer">
		<li class="first">@Html.ActionLinkLocalized("Forums", "List", "Forums")</li>
		<li>@Html.ActionLinkLocalized("Admin", "Dashboard", "Admin")</li>
	</ul>
    <h1>@ViewBag.Title</h1>
    @{Html.BeginForm(null, null, FormMethod.Post, new{@id="manageForm"});}
    @Html.AntiForgeryToken()
    <input type="hidden" name="forum" id="shortName" value="" />
    <ul class="admin">
	@foreach (ForumCategory category in this.Model)
	{
		foreach (Forum f in category.Forums)
		{
			<li>
				<span class="actions">
					@Html.ActionLinkLocalized("Edit", "Edit", "Forums", new { forumId = f.Id }, null)
					<a href="#" onclick="return deleteForum('@(f.ShortName)');">@T("Delete")</a>
				</span>
				    @Html.ActionLink(@category.Name + " > " + f.Name, "Detail", "Forums", new{forum=f.ShortName}, null)
			</li>
		}	
	}
	</ul>
	@{Html.EndForm();}
	<p class="action">@Html.ActionLinkLocalized("Create a new forum >>", "Add", "Forums")</p>

	<script type="text/javascript">
		function deleteForum(name)
		{
			if (confirm('@T("Are you sure you want to delete this forum?.\\nAll threads and posts of this forum will not be accessible.")'))
			{
				$("#shortName").val(name);
				$('#manageForm').attr('action', '@(Url.Action("Delete", "Forums"))').submit();
			}
			return false;
		}
	</script>